package com.example.cloudsampleconsumer.controller;

import com.alibaba.fastjson.JSON;
import com.example.cloudsampleconsumer.model.TestModel;
import com.example.cloudsampleconsumer.service.CloudSampleProviderService;
import com.example.cloudsampleconsumer.service.TestModelService;
import io.seata.spring.annotation.GlobalTransactional;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

@RestController
@RequestMapping("/feign")
public class FeignController {
    @Autowired
    private CloudSampleProviderService cloudSampleProviderService;
    @Value("${server.port}")
    private Integer port;
    @Autowired
    private TestModelService testModelService;

    @RequestMapping("/sayHello")
    public String sayHello() {
        return "feign : " + port + " " + cloudSampleProviderService.sayHello();
    }


    @RequestMapping("/seata")
    public Object seataTest() {
        return testModelService.saveTest();
    }
}
